﻿using System;
using System.IO;

namespace Mono.Cecil.PE
{
	// Token: 0x020000EB RID: 235
	internal class BinaryStreamReader : BinaryReader
	{
		// Token: 0x170002B5 RID: 693
		// (get) Token: 0x0600096C RID: 2412 RVA: 0x0002A344 File Offset: 0x00028544
		// (set) Token: 0x0600096D RID: 2413 RVA: 0x00005675 File Offset: 0x00003875
		public int Position
		{
			get
			{
				return (int)this.BaseStream.Position;
			}
			set
			{
				this.BaseStream.Position = (long)value;
			}
		}

		// Token: 0x170002B6 RID: 694
		// (get) Token: 0x0600096E RID: 2414 RVA: 0x0002A364 File Offset: 0x00028564
		public int Length
		{
			get
			{
				return (int)this.BaseStream.Length;
			}
		}

		// Token: 0x0600096F RID: 2415 RVA: 0x00005686 File Offset: 0x00003886
		public BinaryStreamReader(Stream stream) : base(stream)
		{
		}

		// Token: 0x06000970 RID: 2416 RVA: 0x00005691 File Offset: 0x00003891
		public void Advance(int bytes)
		{
			this.BaseStream.Seek((long)bytes, SeekOrigin.Current);
		}

		// Token: 0x06000971 RID: 2417 RVA: 0x000056A3 File Offset: 0x000038A3
		public void MoveTo(uint position)
		{
			this.BaseStream.Seek((long)((ulong)position), SeekOrigin.Begin);
		}

		// Token: 0x06000972 RID: 2418 RVA: 0x0002A384 File Offset: 0x00028584
		public void Align(int align)
		{
			align--;
			int position = this.Position;
			this.Advance((position + align & ~align) - position);
		}

		// Token: 0x06000973 RID: 2419 RVA: 0x0002A3B0 File Offset: 0x000285B0
		public DataDirectory ReadDataDirectory()
		{
			return new DataDirectory(this.ReadUInt32(), this.ReadUInt32());
		}
	}
}
